#include <iostream>
#include <unistd.h>
#include <cstdlib>
#include <pthread.h>

using namespace std;


void* threadRoutine(void* args)
{
    while(true)
    {
        cout << "new thread , pid : " << getpid() << endl;
        sleep(2);
    }
}


int main()
{
    pthread_t tid;
    pthread_create(&tid,nullptr, threadRoutine, nullptr);

    while(true)
    {
        cout << "main thread , pid : " << getpid() << endl;
        sleep(1);
    }

    return 0;
}